<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">

	<title>Class LeanCloud\ACL</title>

	<link rel="stylesheet" href="resources/style.css?c2f33731c1948fbed7c333554678bfa68d4817da">

</head>

<body>
<div id="left">
	<div id="menu">
		<a href="index.html" title="Overview"><span>Overview</span></a>


		<div id="groups">
				<h3>Namespaces</h3>
			<ul>
				<li class="active">
					<a href="namespace-LeanCloud.html">
						LeanCloud<span></span>
					</a>

						<ul>
				<li>
					<a href="namespace-LeanCloud.Engine.html">
						Engine					</a>

						</li>
				<li>
					<a href="namespace-LeanCloud.Operation.html">
						Operation					</a>

						</li>
				<li>
					<a href="namespace-LeanCloud.Storage.html">
						Storage					</a>

						</li>
				<li>
					<a href="namespace-LeanCloud.Uploader.html">
						Uploader					</a>

						</li>
							</ul></li>
			</ul>
		</div>

		<hr>


		<div id="elements">
			<h3>Classes</h3>
			<ul>
				<li class="active"><a href="class-LeanCloud.ACL.html">ACL</a></li>
				<li><a href="class-LeanCloud.Bytes.html">Bytes</a></li>
				<li><a href="class-LeanCloud.Client.html">Client</a></li>
				<li><a href="class-LeanCloud.File.html">File</a></li>
				<li><a href="class-LeanCloud.GeoPoint.html">GeoPoint</a></li>
				<li><a href="class-LeanCloud.MIMEType.html">MIMEType</a></li>
				<li><a href="class-LeanCloud.Object.html">Object</a></li>
				<li><a href="class-LeanCloud.Push.html">Push</a></li>
				<li><a href="class-LeanCloud.Query.html">Query</a></li>
				<li><a href="class-LeanCloud.Relation.html">Relation</a></li>
				<li><a href="class-LeanCloud.Role.html">Role</a></li>
				<li><a href="class-LeanCloud.SaveOption.html">SaveOption</a></li>
				<li><a href="class-LeanCloud.SMS.html">SMS</a></li>
				<li><a href="class-LeanCloud.User.html">User</a></li>
			</ul>



			<h3>Exceptions</h3>
			<ul>
				<li><a href="class-LeanCloud.BatchRequestError.html">BatchRequestError</a></li>
				<li><a href="class-LeanCloud.CloudException.html">CloudException</a></li>
			</ul>


		</div>
	</div>
</div>

<div id="splitter"></div>

<div id="right">
<div id="rightInner">
	<form id="search">
		<input type="hidden" name="cx" value="">
		<input type="hidden" name="ie" value="UTF-8">
		<input type="text" name="q" class="text" placeholder="Search">
	</form>

	<div id="navigation">
		<ul>
			<li>
				<a href="index.html" title="Overview"><span>Overview</span></a>
			</li>
			<li>
				<a href="namespace-LeanCloud.html" title="Summary of LeanCloud"><span>Namespace</span></a>
			</li>
			<li class="active">
<span>Class</span>			</li>
		</ul>
		<ul>
		</ul>
		<ul>
		</ul>
	</div>

<div id="content" class="class">
	<h1>Class ACL</h1>


	<div class="description">
	<p>Access Control List representation on LeanCloud</p>

<p>An ACL is a field that specifies who can or cannot read/write an
object. The read/write access can be speified for public, or any
users and roles. There can be as many users and roles as possible
in an ACL.</p>
	</div>









	<div class="info">
		
		
		<b>Namespace:</b> <a href="namespace-LeanCloud.html">LeanCloud</a><br>
		

				<b>See:</b>
				<code><a href="class-LeanCloud.Role.html">LeanCloud\Role</a></code><br>
			<b>Located at</b> <a href="source-class-LeanCloud.ACL.html#4-310" title="Go to source code">LeanCloud/ACL.php</a>
		<br>
	</div>



	<table class="summary methods" id="methods">
	<caption>Methods summary</caption>
	<tr data-order="__construct" id="___construct">

		<td class="attributes"><code>
			 public 

			
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#___construct">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#27-58" title="Go to source code">__construct</a>( <span>mixed <var>$val</var> = <span class="php-keyword1">array</span>()</span> )</code>

		<div class="description short">
			<p>Initialize an ACL object</p>
		</div>

		<div class="description detailed hidden">
			<p>Initialize an ACL object</p>

<p>It accepts user, or JSON encoded ACL data. In the former, the
user will be granted both read and write access. While the
latter will be interpretted as JSON encoded array.</p>

<p>With empty param, it creates an ACL with no permission granted.</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$val</var></dt>
					<dd>User or JSON encoded ACL array</dd>
				</dl></div>





		</div>
		</div></td>
	</tr>
	<tr data-order="getPublicReadAccess" id="_getPublicReadAccess">

		<td class="attributes"><code>
			 public 

			boolean
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getPublicReadAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#108-115" title="Go to source code">getPublicReadAccess</a>( )</code>

		<div class="description short">
			<p>Get whether public is allowed to read</p>
		</div>

		<div class="description detailed hidden">
			<p>Get whether public is allowed to read</p>



				<h4>Returns</h4>
				<div class="list">
					boolean
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getPublicWriteAccess" id="_getPublicWriteAccess">

		<td class="attributes"><code>
			 public 

			boolean
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getPublicWriteAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#117-124" title="Go to source code">getPublicWriteAccess</a>( )</code>

		<div class="description short">
			<p>Get whether public is allowed to write</p>
		</div>

		<div class="description detailed hidden">
			<p>Get whether public is allowed to write</p>



				<h4>Returns</h4>
				<div class="list">
					boolean
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="setPublicReadAccess" id="_setPublicReadAccess">

		<td class="attributes"><code>
			 public 

			<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_setPublicReadAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#126-135" title="Go to source code">setPublicReadAccess</a>( <span>boolean <var>$flag</var></span> )</code>

		<div class="description short">
			<p>Set read access for public</p>
		</div>

		<div class="description detailed hidden">
			<p>Set read access for public</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$flag</var></dt>
					<dd>Enable or disable public read</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="setPublicWriteAccess" id="_setPublicWriteAccess">

		<td class="attributes"><code>
			 public 

			<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_setPublicWriteAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#137-146" title="Go to source code">setPublicWriteAccess</a>( <span>boolean <var>$flag</var></span> )</code>

		<div class="description short">
			<p>Set write access for public</p>
		</div>

		<div class="description detailed hidden">
			<p>Set write access for public</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$flag</var></dt>
					<dd>Enable or disable public write</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getRoleReadAccess" id="_getRoleReadAccess">

		<td class="attributes"><code>
			 public 

			boolean
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getRoleReadAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#148-162" title="Go to source code">getRoleReadAccess</a>( <span>string|<code><a href="class-LeanCloud.Role.html">LeanCloud\Role</a></code> <var>$role</var></span> )</code>

		<div class="description short">
			<p>Get explicit read access for role</p>
		</div>

		<div class="description detailed hidden">
			<p>Get explicit read access for role</p>

<p>Even if it returns false, the group may still be able to access
object if object is accessible to public.</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$role</var></dt>
					<dd>object or name</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					boolean
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getRoleWriteAccess" id="_getRoleWriteAccess">

		<td class="attributes"><code>
			 public 

			boolean
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getRoleWriteAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#164-178" title="Go to source code">getRoleWriteAccess</a>( <span>string|<code><a href="class-LeanCloud.Role.html">LeanCloud\Role</a></code> <var>$role</var></span> )</code>

		<div class="description short">
			<p>Get explicit write access for role</p>
		</div>

		<div class="description detailed hidden">
			<p>Get explicit write access for role</p>

<p>Even if it returns false, the group may still be able to access
object if object is accessible to public.</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$role</var></dt>
					<dd>object or name</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					boolean
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="setRoleReadAccess" id="_setRoleReadAccess">

		<td class="attributes"><code>
			 public 

			<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_setRoleReadAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#180-197" title="Go to source code">setRoleReadAccess</a>( <span>string|<code><a href="class-LeanCloud.Role.html">LeanCloud\Role</a></code> <var>$role</var></span>, <span>boolean <var>$flag</var></span> )</code>

		<div class="description short">
			<p>Set read access for role</p>
		</div>

		<div class="description detailed hidden">
			<p>Set read access for role</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$role</var></dt>
					<dd>Role object or role name</dd>
					<dt><var>$flag</var></dt>
					<dd></dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="setRoleWriteAccess" id="_setRoleWriteAccess">

		<td class="attributes"><code>
			 public 

			<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_setRoleWriteAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#199-216" title="Go to source code">setRoleWriteAccess</a>( <span>string|<code><a href="class-LeanCloud.Role.html">LeanCloud\Role</a></code> <var>$role</var></span>, <span>boolean <var>$flag</var></span> )</code>

		<div class="description short">
			<p>Set write access for role</p>
		</div>

		<div class="description detailed hidden">
			<p>Set write access for role</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$role</var></dt>
					<dd>Role object or role name</dd>
					<dt><var>$flag</var></dt>
					<dd></dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getReadAccess" id="_getReadAccess">

		<td class="attributes"><code>
			 public 

			boolean
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getReadAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#218-233" title="Go to source code">getReadAccess</a>( <span>string|<code><a href="class-LeanCloud.User.html">LeanCloud\User</a></code> <var>$user</var></span> )</code>

		<div class="description short">
			<p>Get explicit read access for user</p>
		</div>

		<div class="description detailed hidden">
			<p>Get explicit read access for user</p>

<p>Even if it returns false, the user may still be able to access
object if object is accessible to public or a role the user
belongs to.</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$user</var></dt>
					<dd>Target user or user id</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					boolean
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="getWriteAccess" id="_getWriteAccess">

		<td class="attributes"><code>
			 public 

			boolean
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_getWriteAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#235-250" title="Go to source code">getWriteAccess</a>( <span>string|<code><a href="class-LeanCloud.User.html">LeanCloud\User</a></code> <var>$user</var></span> )</code>

		<div class="description short">
			<p>Get explicit write access for user</p>
		</div>

		<div class="description detailed hidden">
			<p>Get explicit write access for user</p>

<p>Even if it returns false, the user may still be able to access
object if object is accessible to public or a role the user
belongs to.</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$user</var></dt>
					<dd>Target user or user id</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					boolean
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="setReadAccess" id="_setReadAccess">

		<td class="attributes"><code>
			 public 

			<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_setReadAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#252-273" title="Go to source code">setReadAccess</a>( <span>string|<code><a href="class-LeanCloud.User.html">LeanCloud\User</a></code> <var>$user</var></span>, <span>boolean <var>$flag</var></span> )</code>

		<div class="description short">
			<p>Set read access for user</p>
		</div>

		<div class="description detailed hidden">
			<p>Set read access for user</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$user</var></dt>
					<dd>Target user or user id</dd>
					<dt><var>$flag</var></dt>
					<dd>Enable or disable read for user</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="setWriteAccess" id="_setWriteAccess">

		<td class="attributes"><code>
			 public 

			<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_setWriteAccess">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#275-296" title="Go to source code">setWriteAccess</a>( <span>string|<code><a href="class-LeanCloud.User.html">LeanCloud\User</a></code> <var>$user</var></span>, <span>boolean <var>$flag</var></span> )</code>

		<div class="description short">
			<p>Set write access for user</p>
		</div>

		<div class="description detailed hidden">
			<p>Set write access for user</p>


				<h4>Parameters</h4>
				<div class="list"><dl>
					<dt><var>$user</var></dt>
					<dd>Target user or user id</dd>
					<dt><var>$flag</var></dt>
					<dd>Enable or disable write for user</dd>
				</dl></div>

				<h4>Returns</h4>
				<div class="list">
					<code><a href="class-LeanCloud.ACL.html">LeanCloud\ACL</a></code>
				</div>




		</div>
		</div></td>
	</tr>
	<tr data-order="encode" id="_encode">

		<td class="attributes"><code>
			 public 

			array|object
			
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#_encode">#</a>
		<code><a href="source-class-LeanCloud.ACL.html#298-309" title="Go to source code">encode</a>( )</code>

		<div class="description short">
			<p>Encode to JSON representation</p>
		</div>

		<div class="description detailed hidden">
			<p>Encode to JSON representation</p>

<p>It returns an associative array, or an empty object if
empty. The latter is a workaround as we need to json encode
empty ACL as json object, instead of array.</p>



				<h4>Returns</h4>
				<div class="list">
					array|object
				</div>




		</div>
		</div></td>
	</tr>
	</table>








	<table class="summary constants" id="constants">
	<caption>Constants summary</caption>
	<tr data-order="PUBLIC_KEY" id="PUBLIC_KEY">

		<td class="attributes"><code>string</code></td>
		<td class="name">
			<code>
				<a href="source-class-LeanCloud.ACL.html#15-18" title="Go to source code"><b>PUBLIC_KEY</b></a>
			</code>

			<div class="description short">
				<p>Public access key in ACL field</p>
			</div>

			<div class="description detailed hidden">
				<p>Public access key in ACL field</p>

			</div>
		</td>
		<td class="value">
			<div>
				<a href="#PUBLIC_KEY" class="anchor">#</a>
				<code><span class="php-quote">&quot;*&quot;</span></code>
			</div>
		</td>
	</tr>
	</table>










</div>

	<div id="footer">
		 API documentation generated by <a href="http://apigen.org">ApiGen</a>
	</div>
</div>
</div>
<script src="resources/combined.js"></script>
<script src="elementlist.js"></script>
</body>
</html>
